home *** CD-ROM | disk | FTP | other *** search
/ Macintosh Technology Seed 1996 September / Macintosh Technology Seed (September 1996) (CDRM1437020).ISO / pc / qd3d15d6 / 15d6_sdk.exe / QD3D Win32 1.5d6 / Interfaces / QD3D.H next >
C/C++ Source or Header  |  1996-08-21  |  47KB  |  1,311 lines

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3D.h                                                     **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     System include file.                                     **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **                                                                              **
  10.  **     Copyright (C) 1992-1996 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                              **
  12.  **                                                                              **
  13.  *****************************************************************************/
  14. #ifndef QD3D_h
  15. #define QD3D_h
  16.  
  17. #include <stdio.h>
  18.  
  19. /******************************************************************************
  20.  **                                                                             **
  21.  **                                Porting Control                                 **
  22.  **                                                                             **
  23.  *****************************************************************************/
  24.  
  25. /*
  26.  *  NOTE:  To compile on a Unix workstation (assumes X11 window system):
  27.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  28.  *                2. Add "-DOS_UNIX=1"
  29.  *                3. Add "-DWINDOW_SYSTEM_X11=1"
  30.  */
  31. #if defined(_WIN32) || defined(_WINDOWS)
  32.     #define OS_MACINTOSH                0
  33.     #define OS_WIN32                    1
  34.     #define OS_UNIX                        0
  35.  
  36.     #define WINDOW_SYSTEM_MACINTOSH        0
  37.     #define WINDOW_SYSTEM_WIN32            1
  38.     #define WINDOW_SYSTEM_X11            0
  39. #elif !defined(OS_MACINTOSH)
  40.     #define OS_MACINTOSH                1
  41.     #define OS_WIN32                    0
  42.     #define OS_UNIX                        0
  43.  
  44.     #define WINDOW_SYSTEM_MACINTOSH        1
  45.     #define WINDOW_SYSTEM_WIN32            0
  46.     #define WINDOW_SYSTEM_X11            0
  47.  
  48.     #if defined(THINK_C) || defined(__SC__) || defined(__MWERKS__)
  49.          #define PRAGMA_ONCE                1
  50.     #else
  51.          #define PRAGMA_ONCE                0
  52.     #endif  /*  defined(THINK_C) || defined(__SC__) || defined(__MWERKS__)  */
  53.  
  54.     /*
  55.      * Set required compiler options (if possible):
  56.      *   1. enums must always be ints in QD3D and in applications;
  57.      *      this consistency is required to prevent misinterpretation
  58.      *      of an app's enum values by an API; it is also required for
  59.      *      compliance with ANSI
  60.      *   2. alignment of char and short arrays in structures is not on
  61.      *      long boundaries; (could be other way, but must be consistent
  62.      *      in QD3D and in applications)
  63.      *   3. alignment of longs, floats, and pointers in structures
  64.      *      is on long boundaries for PowerPC
  65.      */
  66.     #if defined(THINK_C) || defined(__SC__)
  67.         #pragma options(!pack_enums, !align_arrays)
  68.         #pragma SC options align=power
  69.     #elif defined(__MWERKS__)
  70.         #pragma enumsalwaysint on
  71.         #pragma align_array_members off
  72.         #pragma options align=native
  73.     #elif defined(__PPCC__)
  74.         #pragma options align=power
  75.     #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  76.         #pragma options enum=int
  77.     #endif
  78.     
  79.     enum {
  80.         gestaltQD3D                = 'qd3d',
  81.         gestaltQD3DVersion        = 'q3v ',
  82.         gestaltQD3DNotPresent    = 0,
  83.         gestaltQD3DAvailable    = 1
  84.     };
  85.     
  86. #endif  /*  OS_MACINTOSH  */
  87.  
  88. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  89.     #pragma once
  90. #endif  /*  PRAGMA_ONCE  */
  91.  
  92. /******************************************************************************
  93.  **                                                                             **
  94.  **                                Export Control                                 **
  95.  **                                                                             **
  96.  *****************************************************************************/
  97.  
  98. #if defined(_MSC_VER)    /* Microsoft Visual C */
  99.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  100.         #define QD3D_EXPORT __declspec( dllexport )     
  101.     #else
  102.         #define QD3D_EXPORT __declspec( dllimport )    
  103.     #endif /* WIN32_EXPORTING */
  104. #else
  105.     #define QD3D_EXPORT
  106. #endif  /*  _MSC_VER  */
  107.  
  108.  
  109. /******************************************************************************
  110.  **                                                                             **
  111.  **                                NULL definition                                 **
  112.  **                                                                             **
  113.  *****************************************************************************/
  114.  
  115. #ifndef NULL
  116. #error NULL is undefined.
  117. #endif /* NULL */
  118.  
  119.  
  120. /******************************************************************************
  121.  **                                                                             **
  122.  **                                    Objects                                     **
  123.  **                                                                             **
  124.  *****************************************************************************/
  125. /*
  126.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  127.  * deletion, duplication, and i/o methods.
  128.  */
  129. typedef long                    TQ3ObjectType;
  130.  
  131. typedef struct TQ3ObjectPrivate    *TQ3Object;
  132.  
  133. /*
  134.  * There are four subclasses of OBJECT:
  135.  *    an ELEMENT, which is data that is placed in a SET
  136.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  137.  *    VIEWs, which maintain state information for an image
  138.  *    a PICK, which used to query a VIEW
  139.  */
  140. typedef TQ3Object                TQ3ElementObject;
  141. typedef TQ3Object                TQ3SharedObject;
  142. typedef TQ3Object                TQ3ViewObject;
  143. typedef TQ3Object                TQ3PickObject;
  144.  
  145. /*
  146.  * There are several types of SharedObjects:
  147.  *    RENDERERs, which paint to a drawContext
  148.  *    DRAWCONTEXTs, which are an interface to a device 
  149.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  150.  *    FILEs, which maintain state information for a metafile
  151.  *    SHAPEs, which affect the state of the View
  152.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  153.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  154.  *    TRACKERs, which represent a position and orientation in the user interface
  155.  *  STRINGs, which are abstractions of text string data.
  156.  *    STORAGE, which is an abstraction for stream-based data storage (files, 
  157.  *        memory)
  158.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  159.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  160.  */
  161. typedef TQ3SharedObject            TQ3RendererObject;
  162. typedef TQ3SharedObject            TQ3DrawContextObject;
  163. typedef TQ3SharedObject            TQ3SetObject;
  164. typedef TQ3SharedObject            TQ3FileObject;
  165. typedef TQ3SharedObject            TQ3ShapeObject;
  166. typedef TQ3SharedObject            TQ3ShapePartObject;
  167. typedef TQ3SharedObject            TQ3ControllerStateObject;
  168. typedef TQ3SharedObject            TQ3TrackerObject;
  169. typedef TQ3SharedObject            TQ3StringObject;
  170. typedef TQ3SharedObject            TQ3StorageObject;
  171. typedef TQ3SharedObject            TQ3TextureObject;
  172. typedef TQ3SharedObject            TQ3ViewHintsObject;
  173.  
  174. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  175. /*
  176.  * (and for QuickDraw 3D 1.5)
  177.  *    DEEPBUFFERs, which cache a lot of rasterized information for
  178.  *  deferred interactive imaging.
  179.  *    ATTACHMENTs, for adding parametrizations to geometries
  180.  */
  181. typedef TQ3SharedObject            TQ3DeepBufferObject;
  182. typedef TQ3SharedObject            TQ3AttachmentObject;
  183. #endif  /*  ESCHER_VER_FUTURE  */
  184.  
  185. /*
  186.  * There is one types of SET:
  187.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  188.  */
  189. typedef TQ3SetObject                TQ3AttributeSet;
  190.  
  191. /*
  192.  * There are many types of SHAPEs:
  193.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  194.  *    CAMERAs, which affects the location and orientation of the RENDERER in 
  195.  *        space
  196.  *    GROUPs, which may contain any number of SHARED OBJECTS
  197.  *    GEOMETRYs, which are representations of three-dimensional data
  198.  *    SHADERs, which affect how colors are drawn on a geometry
  199.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  200.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  201.  *    REFERENCEs, which are references to objects in FILEs
  202.  *  UNKNOWN, which hold unknown objects read from a metafile.
  203.  */
  204. typedef TQ3ShapeObject            TQ3GroupObject;
  205. typedef TQ3ShapeObject            TQ3GeometryObject;
  206. typedef TQ3ShapeObject            TQ3ShaderObject;
  207. typedef TQ3ShapeObject            TQ3StyleObject;
  208. typedef TQ3ShapeObject            TQ3TransformObject;
  209. typedef TQ3ShapeObject            TQ3LightObject;
  210. typedef TQ3ShapeObject            TQ3CameraObject;
  211. typedef TQ3ShapeObject            TQ3UnknownObject;
  212. typedef TQ3ShapeObject            TQ3ReferenceObject;
  213.  
  214. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  215. typedef TQ3ShapeObject            TQ3TimeTransformObject;
  216. #endif  /*  ESCHER_VER_FUTURE  */
  217.  
  218. /*
  219.  * For now, there is only one type of SHAPEPARTs:
  220.  *    MESHPARTs, which describe some part of a mesh
  221.  */
  222. typedef TQ3ShapePartObject        TQ3MeshPartObject;
  223.  
  224. /*
  225.  * There are three types of MESHPARTs:
  226.  *    MESHFACEPARTs, which describe a face of a mesh
  227.  *    MESHEDGEPARTs, which describe a edge of a mesh
  228.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  229.  */
  230. typedef TQ3MeshPartObject        TQ3MeshFacePartObject;
  231. typedef TQ3MeshPartObject        TQ3MeshEdgePartObject;
  232. typedef TQ3MeshPartObject        TQ3MeshVertexPartObject;
  233.  
  234. /*
  235.  * A DISPLAY Group can be drawn to a view
  236.  */
  237. typedef TQ3GroupObject            TQ3DisplayGroupObject;
  238.  
  239. /*
  240.  * There are many types of SHADERs:
  241.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  242.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  243.  */
  244. typedef TQ3ShaderObject            TQ3SurfaceShaderObject;
  245. typedef TQ3ShaderObject            TQ3IlluminationShaderObject;
  246.  
  247. /*
  248.  * A handle to an object in a group
  249.  */
  250. typedef struct TQ3GroupPositionPrivate    *TQ3GroupPosition;
  251.  
  252.  
  253. /******************************************************************************
  254.  **                                                                             **
  255.  **                            Client/Server Things                             **
  256.  **                                                                             **
  257.  *****************************************************************************/
  258.  
  259. typedef void *TQ3ControllerRef;
  260.  
  261.  
  262. /******************************************************************************
  263.  **                                                                             **
  264.  **                            Flags and Switches                                 **
  265.  **                                                                             **
  266.  *****************************************************************************/
  267.  
  268. typedef enum TQ3Boolean {
  269.     kQ3False,
  270.     kQ3True
  271. } TQ3Boolean;
  272.  
  273. typedef enum TQ3Switch {
  274.     kQ3Off,
  275.     kQ3On
  276. } TQ3Switch;
  277.  
  278. typedef enum TQ3Status {
  279.     kQ3Failure,
  280.     kQ3Success
  281. } TQ3Status;
  282.  
  283. typedef enum TQ3Axis {
  284.     kQ3AxisX,
  285.     kQ3AxisY,
  286.     kQ3AxisZ
  287. } TQ3Axis;
  288.  
  289. typedef enum TQ3PixelType {
  290.     kQ3PixelTypeRGB32        = 0,    /* Alpha:8 (ignored), R:8, G:8, B:8    */
  291.     kQ3PixelTypeARGB32        = 1,    /* Alpha:8, R:8, G:8, B:8             */
  292.     kQ3PixelTypeRGB16        = 2,    /* Alpha:1 (ignored), R:5, G:5, B:5    */
  293.     kQ3PixelTypeARGB16        = 3        /* Alpha:1, R:5, G:5, B:5             */
  294. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  295.     ,
  296.     kQ3PixelTypeRGB16_565    = 4,    /* 16 bits/pixel, R:5, G:6, B:5        */
  297.     kQ3PixelTypeRGB24        = 5        /* 24 bits/pixel, R:8, G:8, B:8        */
  298. #endif /* WINDOW_SYSTEM_WIN32 */
  299. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  300.     ,
  301.     kQ3PixelTypeCL8            = 6,    /* 8-bit color table index            */
  302.     kQ3PixelTypeCL4            = 7,    /* 4-bit color table index            */
  303.     kQ3PixelTypeAlpha1        = 8        /* alpha                            */
  304. #endif /* ESCHER_VER_FUTURE */
  305. } TQ3PixelType;
  306.  
  307. typedef enum TQ3Endian{
  308.     kQ3EndianBig,
  309.     kQ3EndianLittle
  310. } TQ3Endian;
  311.  
  312. typedef enum TQ3EndCapMasks {
  313.     kQ3EndCapNone            = 0,
  314.     kQ3EndCapMaskTop        = 1 << 0,
  315.     kQ3EndCapMaskBottom        = 1 << 1,
  316.     kQ3EndCapMaskInterior    = 1 << 2
  317. } TQ3EndCapMasks;
  318.  
  319. typedef unsigned long TQ3EndCap;
  320.  
  321. enum {
  322.     kQ3ArrayIndexNULL = ~0
  323. };
  324.  
  325.  
  326. /******************************************************************************
  327.  **                                                                             **
  328.  **                        Point and Vector Definitions                         **
  329.  **                                                                             **
  330.  *****************************************************************************/
  331.  
  332. typedef struct TQ3Vector2D {
  333.     float        x;
  334.     float        y;
  335. } TQ3Vector2D;
  336.  
  337. typedef struct TQ3Vector3D {
  338.     float         x;
  339.     float        y;
  340.     float        z;
  341. } TQ3Vector3D;
  342.  
  343. typedef struct TQ3Point2D {
  344.     float        x;
  345.     float        y;
  346. } TQ3Point2D;
  347.  
  348. typedef struct TQ3Point3D {
  349.     float         x;
  350.     float        y;
  351.     float        z;
  352. } TQ3Point3D;
  353.  
  354. typedef struct TQ3RationalPoint4D {
  355.     float         x;
  356.     float        y;
  357.     float        z;
  358.     float        w;
  359. } TQ3RationalPoint4D;
  360.  
  361. typedef struct TQ3RationalPoint3D {
  362.     float        x;
  363.     float        y;
  364.     float        w;
  365. } TQ3RationalPoint3D;
  366.  
  367.  
  368. /******************************************************************************
  369.  **                                                                             **
  370.  **                                Quaternion                                     **
  371.  **                                                                             **
  372.  *****************************************************************************/
  373.  
  374. typedef struct TQ3Quaternion {
  375.     float        w;
  376.     float        x;
  377.     float        y;
  378.     float        z;
  379. } TQ3Quaternion;
  380.  
  381.  
  382. /******************************************************************************
  383.  **                                                                             **
  384.  **                                Ray Definition                                 **
  385.  **                                                                             **
  386.  *****************************************************************************/
  387.  
  388. typedef struct TQ3Ray3D {
  389.     TQ3Point3D        origin;
  390.     TQ3Vector3D        direction;
  391. } TQ3Ray3D;
  392.  
  393.  
  394. /******************************************************************************
  395.  **                                                                             **
  396.  **                        Parameterization Data Structures                     **
  397.  **                                                                             **
  398.  *****************************************************************************/
  399.  
  400. typedef struct TQ3Param2D {
  401.     float            u;
  402.     float            v;
  403. } TQ3Param2D;
  404.  
  405. typedef struct TQ3Param3D {
  406.     float            u;
  407.     float            v;
  408.     float            w;
  409. } TQ3Param3D;
  410.  
  411. typedef struct TQ3Tangent2D {
  412.     TQ3Vector3D        uTangent;
  413.     TQ3Vector3D        vTangent;
  414. } TQ3Tangent2D;
  415.  
  416. typedef struct TQ3Tangent3D {
  417.     TQ3Vector3D        uTangent;
  418.     TQ3Vector3D        vTangent;
  419.     TQ3Vector3D        wTangent;
  420. } TQ3Tangent3D;
  421.  
  422.  
  423. /******************************************************************************
  424.  **                                                                             **
  425.  **                        Polar and Spherical Coordinates                         **
  426.  **                                                                             **
  427.  *****************************************************************************/
  428.  
  429.  typedef struct TQ3PolarPoint {
  430.      float        r;
  431.      float        theta;
  432.   } TQ3PolarPoint;
  433.  
  434.  typedef struct TQ3SphericalPoint {
  435.      float        rho;
  436.      float        theta;
  437.      float        phi;
  438.  } TQ3SphericalPoint;
  439.  
  440.  
  441. /******************************************************************************
  442.  **                                                                             **
  443.  **                            Color Definition                                 **
  444.  **                                                                             **
  445.  *****************************************************************************/
  446.  
  447. typedef struct TQ3ColorRGB {
  448.     float             r;
  449.     float            g;
  450.     float            b;
  451. } TQ3ColorRGB;
  452.  
  453.  
  454. typedef struct TQ3ColorARGB {
  455.     float             a;
  456.     float             r;
  457.     float            g;
  458.     float            b;
  459. } TQ3ColorARGB;
  460.  
  461.  
  462. /******************************************************************************
  463.  **                                                                             **
  464.  **                                    Vertices                                 **
  465.  **                                                                             **
  466.  *****************************************************************************/
  467.  
  468. typedef struct TQ3Vertex3D {
  469.     TQ3Point3D            point;
  470.     TQ3AttributeSet        attributeSet;
  471. }  TQ3Vertex3D;
  472.  
  473.  
  474. /******************************************************************************
  475.  **                                                                             **
  476.  **                                    Matrices                                 **
  477.  **                                                                             **
  478.  *****************************************************************************/
  479.  
  480. typedef struct TQ3Matrix3x3 {
  481.     float    value[3][3];
  482. } TQ3Matrix3x3;
  483.  
  484. typedef struct TQ3Matrix4x4 {
  485.     float    value[4][4];
  486. } TQ3Matrix4x4;
  487.  
  488.  
  489. /******************************************************************************
  490.  **                                                                             **
  491.  **                                Color Table                                     **
  492.  **                                                                             **
  493.  *****************************************************************************/
  494.  
  495. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  496. typedef unsigned long TQ3ColorRGB32;        /* A:8 (ignored), R:8, G:8, B:8 */
  497.  
  498. typedef enum TQ3ColorTableType {
  499.     kQ3ColorTableType_CL8_RGB32        = 0,    /* 256 entries of TQ3ColorRGB32    */
  500.     kQ3ColorTableType_CL4_RGB32        = 1        /* 16 entries of TQ3ColorRGB32    */
  501. } TQ3ColorTableType;
  502.  
  503. typedef struct TQ3ColorTableData {
  504.     TQ3ColorTableType        colorTableType;
  505.     TQ3Boolean                hasTransparent;    /* true if index zero is transp.*/
  506.     TQ3ColorRGB32            colors[256];    /* actual # determined from type*/
  507. } TQ3ColorTableData;
  508.  
  509. typedef TQ3SharedObject    TQ3ColorTableObject;
  510. #endif /* ESCHER_VER_FUTURE */
  511.  
  512.  
  513. /******************************************************************************
  514.  **                                                                             **
  515.  **                                Bitmap/Pixmap                                 **
  516.  **                                                                             **
  517.  *****************************************************************************/
  518.  
  519. typedef struct TQ3Pixmap {
  520.     void                *image;
  521.     unsigned long        width;
  522.     unsigned long        height;
  523.     unsigned long        rowBytes;
  524.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the         */
  525.                                     /* Interactive Renderer on Mac OS         */
  526.     TQ3PixelType        pixelType;
  527.     TQ3Endian            bitOrder;
  528.     TQ3Endian            byteOrder;
  529. } TQ3Pixmap;
  530.  
  531. typedef struct TQ3StoragePixmap {
  532.     TQ3StorageObject    image;
  533.     unsigned long        width;
  534.     unsigned long        height;
  535.     unsigned long        rowBytes;
  536.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the     */
  537.                                     /* Interactive Renderer on Mac OS        */
  538.     TQ3PixelType        pixelType;
  539.     TQ3Endian            bitOrder;
  540.     TQ3Endian            byteOrder;
  541. } TQ3StoragePixmap;
  542.  
  543. typedef struct TQ3Bitmap {
  544.     unsigned char        *image;
  545.     unsigned long        width;
  546.     unsigned long        height;
  547.     unsigned long        rowBytes;
  548.     TQ3Endian            bitOrder;
  549. } TQ3Bitmap;
  550.  
  551. typedef struct TQ3MipmapImage {        /* An image for use as a texture mipmap  */
  552.     unsigned long        width;        /* Width of mipmap, must be power of 2   */
  553.     unsigned long        height;        /* Height of mipmap, must be power of 2  */
  554.     unsigned long        rowBytes;    /* Rowbytes of mipmap                    */
  555.     unsigned long        offset;        /* Offset from image base to this mipmap */
  556. } TQ3MipmapImage;
  557.  
  558. typedef struct TQ3Mipmap {
  559.     TQ3StorageObject    image;        /* Data containing the texture map and     */
  560.                                     /* if (mipmap==kQ3True) the mipmap data */
  561.     TQ3Boolean            mipmap;        /* True if mipmapping should be used     */
  562.                                     /* and all mipmaps have been provided   */
  563.     TQ3PixelType        pixelType;
  564.     TQ3Endian            bitOrder;
  565.     TQ3Endian            byteOrder;
  566. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  567.     TQ3ColorTableObject    colorTable;
  568. #else
  569.     unsigned long        reserved;    /* leave NULL for next version */
  570. #endif /* ESCHER_VER_FUTURE */
  571.     TQ3MipmapImage        mipmaps[32];/* The actual number of mipmaps is         */
  572.                                     /* determined from the size of the         */
  573.                                     /* first mipmap                            */
  574. } TQ3Mipmap;
  575.  
  576.  
  577. /******************************************************************************
  578.  **                                                                             **
  579.  **                        Higher dimension quantities                             **
  580.  **                                                                             **
  581.  *****************************************************************************/
  582.  
  583. typedef struct TQ3Area {
  584.     TQ3Point2D             min;
  585.     TQ3Point2D             max;
  586. } TQ3Area;
  587.  
  588. typedef struct TQ3PlaneEquation {
  589.     TQ3Vector3D            normal;
  590.     float                constant;
  591. } TQ3PlaneEquation;
  592.  
  593. typedef struct TQ3BoundingBox {
  594.     TQ3Point3D             min;
  595.     TQ3Point3D             max;
  596.     TQ3Boolean            isEmpty;
  597. } TQ3BoundingBox;
  598.  
  599. typedef struct TQ3BoundingSphere {
  600.     TQ3Point3D            origin;
  601.     float                radius;
  602.     TQ3Boolean            isEmpty;
  603. } TQ3BoundingSphere;
  604.  
  605. /*
  606.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  607.  *    calls in the View. It's a hint to the system as to how it should 
  608.  *    compute the bbox of a shape:
  609.  *
  610.  *    kQ3ComputeBoundsExact:    
  611.  *        Vertices of shapes are transformed into world space and
  612.  *        the world space bounding box is computed from them.  Slow!
  613.  *    
  614.  *    kQ3ComputeBoundsApproximate: 
  615.  *        A local space bounding box is computed from a shape's
  616.  *        vertices.  This bbox is then transformed into world space,
  617.  *        and its bounding box is taken as the shape's approximate
  618.  *        bbox.  Fast but the bbox is larger than optimal.
  619.  */
  620.  
  621. typedef enum TQ3ComputeBounds {
  622.     kQ3ComputeBoundsExact,
  623.     kQ3ComputeBoundsApproximate
  624. } TQ3ComputeBounds;
  625.  
  626.  
  627. /******************************************************************************
  628.  **                                                                             **
  629.  **                            Object System Types                                 **
  630.  **                                                                             **
  631.  *****************************************************************************/
  632.  
  633. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE
  634. typedef struct TQ3ObjectClassPrivate        *TQ3ObjectClass;
  635.  
  636. typedef unsigned long                         TQ3MethodType;
  637.  
  638. /*
  639.  * Object methods
  640.  */
  641. #define kQ3MethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  642.  
  643. /*
  644.  * IO Methods
  645.  */
  646. #define kQ3MethodTypeObjectFileVersion    Q3_METHOD_TYPE('v','e','r','s') /* version */
  647. #define kQ3MethodTypeObjectTraverse        Q3_METHOD_TYPE('t','r','v','s') /* byte count */
  648. #define kQ3MethodTypeObjectTraverseData    Q3_METHOD_TYPE('t','r','v','d') /* byte count */
  649. #define kQ3MethodTypeObjectWrite        Q3_METHOD_TYPE('w','r','i','t') /* Dump info to file */
  650. #define kQ3MethodTypeObjectReadData        Q3_METHOD_TYPE('r','d','d','t') /* Read info from file into buffer or, attach read data to parent */ 
  651.  
  652. typedef void (*TQ3FunctionPointer)(
  653.     void);
  654.  
  655. typedef TQ3FunctionPointer (*TQ3MetaHandler)(
  656.     TQ3MethodType        methodType);
  657.  
  658. /*
  659.  * MetaHandler:
  660.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  661.  *        times to build method tables, and then is thrown away. You are 
  662.  *        guaranteed that your metahandler will never be called again after a 
  663.  *        call that was passed a metahandler returns.
  664.  *
  665.  *        Your metahandler should contain a switch on the methodType passed to it
  666.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  667.  *
  668.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  669.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  670.  *
  671.  *        These types here are prototypes of how your functions should look.
  672.  */
  673.  
  674. typedef TQ3Status (*TQ3ObjectUnregisterMethod)(
  675.     TQ3ObjectClass        objectClass);
  676.     
  677. #endif  /*  QD3D_OBSOLETE  */
  678.  
  679.  
  680. typedef struct TQ3ObjectClassPrivate        *TQ3XObjectClass;
  681.  
  682. typedef unsigned long                         TQ3XMethodType;
  683.  
  684. /*
  685.  * Object methods
  686.  */
  687. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  688.  
  689. /*
  690.  * IO Methods
  691.  */
  692. #define kQ3XMethodTypeObjectFileVersion        Q3_METHOD_TYPE('v','e','r','s') /* version */
  693. #define kQ3XMethodTypeObjectTraverse        Q3_METHOD_TYPE('t','r','v','s') /* byte count */
  694. #define kQ3XMethodTypeObjectTraverseData    Q3_METHOD_TYPE('t','r','v','d') /* byte count */
  695. #define kQ3XMethodTypeObjectWrite            Q3_METHOD_TYPE('w','r','i','t') /* Dump info to file */
  696. #define kQ3XMethodTypeObjectReadData        Q3_METHOD_TYPE('r','d','d','t') /* Read info from file into buffer or, attach read data to parent */ 
  697.  
  698. typedef void (*TQ3XFunctionPointer)(
  699.     void);
  700.  
  701. typedef TQ3XFunctionPointer (*TQ3XMetaHandler)(
  702.     TQ3XMethodType        methodType);
  703.  
  704. /*
  705.  * MetaHandler:
  706.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  707.  *        times to build method tables, and then is thrown away. You are 
  708.  *        guaranteed that your metahandler will never be called again after a 
  709.  *        call that was passed a metahandler returns.
  710.  *
  711.  *        Your metahandler should contain a switch on the methodType passed to it
  712.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  713.  *
  714.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  715.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  716.  *
  717.  *        These types here are prototypes of how your functions should look.
  718.  */
  719.  
  720. typedef TQ3Status (*TQ3XObjectUnregisterMethod)(
  721.     TQ3XObjectClass        objectClass);
  722.     
  723. /*
  724.  * See QD3DIO.h for the IO method types: 
  725.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  726.  */
  727.  
  728.  
  729. /******************************************************************************
  730.  **                                                                             **
  731.  **                                Set Types                                     **
  732.  **                                                                             **
  733.  *****************************************************************************/
  734.  
  735. typedef long                    TQ3ElementType;
  736.  
  737. #define kQ3ElementTypeNone        0
  738. #define kQ3ElementTypeUnknown    32
  739. #define kQ3ElementTypeSet        33
  740. #define kQ3ElementTypeName        34
  741. #define kQ3ElementTypeURL        35
  742.  
  743. /* 
  744.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  745.  *    
  746.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  747.  *        
  748.  *        Note that the object is always referenced when copying around. 
  749.  *        
  750.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  751.  *        group of other "objects" which have been found in the metafile and
  752.  *        have no attachment method to their parent. Be prepared to handle
  753.  *        any or all of these cases if you actually access the set on a shape.
  754.  *
  755.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  756.  *    
  757.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  758.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  759.  *            
  760.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  761.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  762.  *    
  763.  *        Note that the object is always referenced when copying around. 
  764.  *        
  765.  *    See the note below about the Set and Shape changes.
  766.  */
  767.  
  768. /******************************************************************************
  769.  **                                                                             **
  770.  **                            Object System Macros                             **
  771.  **                                                                             **
  772.  *****************************************************************************/
  773.  
  774. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  775.             ((const unsigned long)                     \
  776.             ((const unsigned long) (a) << 24) |     \
  777.             ((const unsigned long) (b) << 16) |        \
  778.             ((const unsigned long) (c) << 8)  |     \
  779.             ((const unsigned long) (d)))
  780.  
  781. #define Q3_OBJECT_TYPE(a,b,c,d) \
  782.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  783.  
  784. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE    
  785. #define Q3_METHOD_TYPE(a,b,c,d) \
  786.     ((TQ3MethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  787. #else
  788. #define Q3_METHOD_TYPE(a,b,c,d) \
  789.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  790.  
  791. #endif  /*  QD3D_OBSOLETE  */
  792.  
  793.  
  794. /******************************************************************************
  795.  **                                                                             **
  796.  **                                Object Types                                 **
  797.  **                                                                             **
  798.  *****************************************************************************/
  799.  
  800. /*
  801.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  802.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  803.  */
  804. #define kQ3ObjectTypeInvalid                            0
  805. #define kQ3ObjectTypeView                                Q3_OBJECT_TYPE('v','i','e','w')
  806. #define kQ3ObjectTypeElement                            Q3_OBJECT_TYPE('e','l','m','n')
  807.     #define kQ3ElementTypeAttribute                        Q3_OBJECT_TYPE('e','a','t','t')
  808. #define kQ3ObjectTypePick                                Q3_OBJECT_TYPE('p','i','c','k')
  809.     #define kQ3PickTypeWindowPoint                        Q3_OBJECT_TYPE('p','k','w','p')
  810.     #define kQ3PickTypeWindowRect                        Q3_OBJECT_TYPE('p','k','w','r')
  811.     #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  812.     #define kQ3PickTypeBox                                Q3_OBJECT_TYPE('p','k','b','x')
  813.     #define kQ3PickTypeRay                                Q3_OBJECT_TYPE('p','k','r','y')
  814.     #define kQ3PickTypeSphere                            Q3_OBJECT_TYPE('p','k','s','p')
  815.     #endif  /*  ESCHER_VER_FUTURE  */
  816. #define kQ3ObjectTypeShared                                Q3_OBJECT_TYPE('s','h','r','d')
  817.     #define kQ3SharedTypeRenderer                        Q3_OBJECT_TYPE('r','d','d','r')
  818.         #define kQ3RendererTypeWireFrame                Q3_OBJECT_TYPE('w','r','f','r')
  819.         #define kQ3RendererTypeGeneric                    Q3_OBJECT_TYPE('g','n','r','r')
  820.         #define kQ3RendererTypeInteractive                Q3_OBJECT_TYPE('c','t','w','n')
  821.     #define kQ3SharedTypeShape                            Q3_OBJECT_TYPE('s','h','a','p')
  822.         #define kQ3ShapeTypeGeometry                    Q3_OBJECT_TYPE('g','m','t','r')
  823.             #define kQ3GeometryTypeBox                    Q3_OBJECT_TYPE('b','o','x',' ')
  824.             #define kQ3GeometryTypeGeneralPolygon        Q3_OBJECT_TYPE('g','p','g','n')
  825.             #define kQ3GeometryTypeLine                    Q3_OBJECT_TYPE('l','i','n','e')
  826.             #define kQ3GeometryTypeMarker                Q3_OBJECT_TYPE('m','r','k','r')
  827.             #define kQ3GeometryTypePixmapMarker            Q3_OBJECT_TYPE('m','r','k','p')
  828.             #define kQ3GeometryTypeMesh                    Q3_OBJECT_TYPE('m','e','s','h')
  829.             #define kQ3GeometryTypeNURBCurve            Q3_OBJECT_TYPE('n','r','b','c')
  830.             #define kQ3GeometryTypeNURBPatch            Q3_OBJECT_TYPE('n','r','b','p')
  831.             #define kQ3GeometryTypePoint                Q3_OBJECT_TYPE('p','n','t',' ')
  832.             #define kQ3GeometryTypePolygon                Q3_OBJECT_TYPE('p','l','y','g')
  833.             #define kQ3GeometryTypePolyLine                Q3_OBJECT_TYPE('p','l','y','l')
  834.             #define kQ3GeometryTypeTriangle                Q3_OBJECT_TYPE('t','r','n','g')
  835.             #define kQ3GeometryTypeTriGrid                Q3_OBJECT_TYPE('t','r','i','g')
  836.             #define kQ3GeometryTypeCone                    Q3_OBJECT_TYPE('c','o','n','e')
  837.             #define kQ3GeometryTypeCylinder                Q3_OBJECT_TYPE('c','y','l','n')
  838.             #define kQ3GeometryTypeDisk                    Q3_OBJECT_TYPE('d','i','s','k')
  839.             #define kQ3GeometryTypeEllipse                Q3_OBJECT_TYPE('e','l','p','s')
  840.             #define kQ3GeometryTypeEllipsoid            Q3_OBJECT_TYPE('e','l','p','d')
  841.             #define kQ3GeometryTypePolyhedron            Q3_OBJECT_TYPE('p','l','h','d')
  842.             #define kQ3GeometryTypeTorus                Q3_OBJECT_TYPE('t','o','r','s')
  843.             #define kQ3GeometryTypeTriMesh                Q3_OBJECT_TYPE('t','m','s','h')
  844.         #define kQ3ShapeTypeShader                        Q3_OBJECT_TYPE('s','h','d','r')
  845.             #define kQ3ShaderTypeSurface                Q3_OBJECT_TYPE('s','u','s','h')
  846.                 #define kQ3SurfaceShaderTypeTexture        Q3_OBJECT_TYPE('t','x','s','u')
  847.             #define kQ3ShaderTypeIllumination            Q3_OBJECT_TYPE('i','l','s','h')
  848.                 #define kQ3IlluminationTypePhong        Q3_OBJECT_TYPE('p','h','i','l')
  849.                 #define kQ3IlluminationTypeLambert        Q3_OBJECT_TYPE('l','m','i','l')
  850.                 #define kQ3IlluminationTypeNULL            Q3_OBJECT_TYPE('n','u','i','l')
  851.             #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  852.             #define kQ3ShaderTypeImage                    Q3_OBJECT_TYPE('i','m','s','h')
  853.             #define kQ3ShaderTypeTrim                    Q3_OBJECT_TYPE('t','r','s','h')
  854.             #define kQ3ShaderTypeAtmospheric            Q3_OBJECT_TYPE('a','t','s','h')
  855.             #endif  /*  ESCHER_VER_FUTURE  */
  856.         #define kQ3ShapeTypeStyle                        Q3_OBJECT_TYPE('s','t','y','l')
  857.             #define kQ3StyleTypeBackfacing                Q3_OBJECT_TYPE('b','c','k','f')
  858.             #define kQ3StyleTypeInterpolation            Q3_OBJECT_TYPE('i','n','t','p')
  859.             #define kQ3StyleTypeFill                    Q3_OBJECT_TYPE('f','i','s','t')
  860.             #define kQ3StyleTypePickID                    Q3_OBJECT_TYPE('p','k','i','d')
  861.             #define kQ3StyleTypeReceiveShadows            Q3_OBJECT_TYPE('r','c','s','h')
  862.             #define kQ3StyleTypeHighlight                Q3_OBJECT_TYPE('h','i','g','h')
  863.             #define kQ3StyleTypeSubdivision                Q3_OBJECT_TYPE('s','b','d','v')
  864.             #define kQ3StyleTypeOrientation                Q3_OBJECT_TYPE('o','f','d','r')
  865.             #define kQ3StyleTypePickParts                Q3_OBJECT_TYPE('p','k','p','t')
  866.             #define kQ3StyleTypeZCompare                Q3_OBJECT_TYPE('z','c','m','p')
  867.             #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  868.             #define kQ3StyleTypeAntiAlias                Q3_OBJECT_TYPE('a','n','t','i')
  869.             #endif
  870.             #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  871.             #define kQ3StyleTypeAnimation                Q3_OBJECT_TYPE('a','n','i','m')
  872.             #endif  /*  ESCHER_VER_FUTURE  */
  873.         #define kQ3ShapeTypeTransform                    Q3_OBJECT_TYPE('x','f','r','m')
  874.             #define kQ3TransformTypeMatrix                Q3_OBJECT_TYPE('m','t','r','x')
  875.             #define kQ3TransformTypeScale                Q3_OBJECT_TYPE('s','c','a','l')
  876.             #define kQ3TransformTypeTranslate            Q3_OBJECT_TYPE('t','r','n','s')
  877.             #define kQ3TransformTypeRotate                Q3_OBJECT_TYPE('r','o','t','t')
  878.             #define kQ3TransformTypeRotateAboutPoint     Q3_OBJECT_TYPE('r','t','a','p')
  879.             #define kQ3TransformTypeRotateAboutAxis     Q3_OBJECT_TYPE('r','t','a','a')
  880.             #define kQ3TransformTypeQuaternion            Q3_OBJECT_TYPE('q','t','r','n')
  881.             #define kQ3TransformTypeReset                Q3_OBJECT_TYPE('r','s','e','t')
  882.         #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  883.         #define kQ3ShapeTypeTimeTransform                Q3_OBJECT_TYPE('t','f','r','m')
  884.             #define kQ3TimeTransformTypeMod                Q3_OBJECT_TYPE('t','m','m','d')
  885.             #define kQ3TimeTransformTypeScale            Q3_OBJECT_TYPE('t','m','s','c')
  886.             #define kQ3TimeTransformTypeShift            Q3_OBJECT_TYPE('t','m','s','t')
  887.         #endif  /*  ESCHER_VER_FUTURE  */
  888.         #define kQ3ShapeTypeLight                        Q3_OBJECT_TYPE('l','g','h','t')
  889.             #define kQ3LightTypeAmbient                    Q3_OBJECT_TYPE('a','m','b','n')
  890.             #define kQ3LightTypeDirectional                Q3_OBJECT_TYPE('d','r','c','t')
  891.             #define kQ3LightTypePoint                    Q3_OBJECT_TYPE('p','n','t','l')
  892.             #define kQ3LightTypeSpot                    Q3_OBJECT_TYPE('s','p','o','t')
  893.         #define kQ3ShapeTypeCamera                        Q3_OBJECT_TYPE('c','m','r','a')
  894.             #define kQ3CameraTypeOrthographic            Q3_OBJECT_TYPE('o','r','t','h')
  895.             #define kQ3CameraTypeViewPlane                Q3_OBJECT_TYPE('v','w','p','l')
  896.             #define kQ3CameraTypeViewAngleAspect        Q3_OBJECT_TYPE('v','a','n','a')
  897.     
  898.         #define kQ3ShapeTypeGroup                        Q3_OBJECT_TYPE('g','r','u','p')
  899.             #define kQ3GroupTypeDisplay                    Q3_OBJECT_TYPE('d','s','p','g')
  900.                 #define kQ3DisplayGroupTypeOrdered        Q3_OBJECT_TYPE('o','r','d','g')
  901.                 #define kQ3DisplayGroupTypeIOProxy        Q3_OBJECT_TYPE('i','o','p','x')
  902.                 #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  903.                 #define kQ3DisplayGroupTypeKeyFrame        Q3_OBJECT_TYPE('k','f','r','m')
  904.                 #endif  /*  ESCHER_VER_FUTURE  */
  905.             #define kQ3GroupTypeLight                    Q3_OBJECT_TYPE('l','g','h','g')
  906.             #define kQ3GroupTypeInfo                    Q3_OBJECT_TYPE('i','n','f','o')
  907.         #define kQ3ShapeTypeUnknown                        Q3_OBJECT_TYPE('u','n','k','n')
  908.             #define kQ3UnknownTypeText                    Q3_OBJECT_TYPE('u','k','t','x')
  909.             #define kQ3UnknownTypeBinary                Q3_OBJECT_TYPE('u','k','b','n')
  910.         #define kQ3ShapeTypeReference                    Q3_OBJECT_TYPE('r','f','r','n')
  911.             #define kQ3ReferenceTypeExternal            Q3_OBJECT_TYPE('r','f','e','x')
  912.     #define kQ3SharedTypeSet                            Q3_OBJECT_TYPE('s','e','t',' ')
  913.         #define kQ3SetTypeAttribute                        Q3_OBJECT_TYPE('a','t','t','r')
  914.     #define kQ3SharedTypeDrawContext                    Q3_OBJECT_TYPE('d','c','t','x')
  915.         #define kQ3DrawContextTypePixmap                Q3_OBJECT_TYPE('d','p','x','p')
  916.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  917.         #define kQ3DrawContextTypeMacintosh                Q3_OBJECT_TYPE('d','m','a','c')
  918.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  919.         #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  920.         #define kQ3DrawContextTypeWin32DC                Q3_OBJECT_TYPE('d','w','3','2')
  921.         #define kQ3DrawContextTypeDDSurface                Q3_OBJECT_TYPE('d','d','d','s')
  922.         #endif  /*  WINDOW_SYSTEM_WIN32  */
  923.         #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  924.         #define kQ3DrawContextTypeX11                    Q3_OBJECT_TYPE('d','x','1','1')
  925.         #endif  /*  WINDOW_SYSTEM_X11  */
  926.         #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  927.         #define kQ3DrawContextTypeFile                    Q3_OBJECT_TYPE('d','f','i','l')
  928.         #endif  /*  ESCHER_VER_FUTURE  */
  929.     #define kQ3SharedTypeTexture                        Q3_OBJECT_TYPE('t','x','t','r')
  930.         #define kQ3TextureTypePixmap                    Q3_OBJECT_TYPE('t','x','p','m')
  931.         #define kQ3TextureTypeMipmap                    Q3_OBJECT_TYPE('t','x','m','m')
  932.         #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  933.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  934.         #define kQ3TextureTypeQuickdrawGX                Q3_OBJECT_TYPE('t','x','g','x')
  935.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  936.         #endif  /*  ESCHER_VER_FUTURE  */
  937.     #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  938.     #define kQ3SharedTypeAttachment                        Q3_OBJECT_TYPE('a','t','c','h')
  939.     #endif  /*  ESCHER_VER_FUTURE  */
  940.     #define kQ3SharedTypeFile                            Q3_OBJECT_TYPE('f','i','l','e')
  941.     #define kQ3SharedTypeStorage                        Q3_OBJECT_TYPE('s','t','r','g')
  942.         #define kQ3StorageTypeMemory                    Q3_OBJECT_TYPE('m','e','m','s')
  943.             #if defined(OS_MACINTOSH) && OS_MACINTOSH
  944.             #define kQ3MemoryStorageTypeHandle            Q3_OBJECT_TYPE('h','n','d','l')
  945.             #endif  /*  OS_MACINTOSH  */
  946.         #define kQ3StorageTypeUnix                        Q3_OBJECT_TYPE('u','x','s','t')
  947.             #define kQ3UnixStorageTypePath                Q3_OBJECT_TYPE('u','n','i','x')
  948.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  949.         #define kQ3StorageTypeMacintosh                    Q3_OBJECT_TYPE('m','a','c','n')
  950.             #define kQ3MacintoshStorageTypeFSSpec        Q3_OBJECT_TYPE('m','a','c','p')                    
  951.         #endif  /*  OS_MACINTOSH  */
  952.         #if defined(OS_WIN32) && OS_WIN32
  953.         #define kQ3StorageTypeWin32                        Q3_OBJECT_TYPE('w','i','s','t')
  954.         #endif  /*  OS_WIN32  */
  955.     #define kQ3SharedTypeString                            Q3_OBJECT_TYPE('s','t','r','n')
  956.         #define kQ3StringTypeCString                    Q3_OBJECT_TYPE('s','t','r','c')
  957.         #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  958.         #define kQ3StringTypeUnicode                    Q3_OBJECT_TYPE('u','n','c','d')
  959.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  960.         #define kQ3StringTypeWorldScript                Q3_OBJECT_TYPE('s','c','r','p')
  961.         #endif  /*  OS_MACINTOSH  */
  962.         #endif  /*  ESCHER_VER_FUTURE  */
  963.     #define kQ3SharedTypeShapePart                        Q3_OBJECT_TYPE('s','p','r','t')
  964.         #define kQ3ShapePartTypeMeshPart                Q3_OBJECT_TYPE('s','p','m','h')
  965.             #define kQ3MeshPartTypeMeshFacePart            Q3_OBJECT_TYPE('m','f','a','c')
  966.             #define kQ3MeshPartTypeMeshEdgePart            Q3_OBJECT_TYPE('m','e','d','g')
  967.             #define kQ3MeshPartTypeMeshVertexPart        Q3_OBJECT_TYPE('m','v','t','x')
  968.     #define kQ3SharedTypeControllerState                Q3_OBJECT_TYPE('c','t','s','t')
  969.     #define kQ3SharedTypeTracker                        Q3_OBJECT_TYPE('t','r','k','r')
  970.     #define kQ3SharedTypeViewHints                        Q3_OBJECT_TYPE('v','w','h','n')
  971.     #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  972.     #define kQ3SharedTypeDeepBuffer                        Q3_OBJECT_TYPE('d','e','e','p')
  973.     #define kQ3SharedTypeColorTable                        Q3_OBJECT_TYPE('c','l','u','t')
  974.     #endif /*  ESCHER_VER_FUTURE  */
  975.     #define kQ3SharedTypeEndGroup                        Q3_OBJECT_TYPE('e','n','d','g')
  976.  
  977.  
  978. #ifdef __cplusplus
  979. extern "C" {
  980. #endif    /* __cplusplus */
  981.  
  982. /******************************************************************************
  983.  **                                                                             **
  984.  **                            QuickDraw 3D System Routines                     **
  985.  **                                                                             **
  986.  *****************************************************************************/
  987.  
  988. QD3D_EXPORT TQ3Status Q3Initialize(
  989.     void);
  990.  
  991. QD3D_EXPORT TQ3Status Q3Exit(
  992.     void);
  993.  
  994. QD3D_EXPORT TQ3Boolean Q3IsInitialized(
  995.     void);
  996.  
  997. QD3D_EXPORT TQ3Status Q3GetVersion(
  998.     unsigned long        *majorRevision,
  999.     unsigned long        *minorRevision);
  1000.  
  1001.  
  1002. /******************************************************************************
  1003.  **                                                                             **
  1004.  **                            ObjectClass Routines                             **
  1005.  **                                                                             **
  1006.  *****************************************************************************/
  1007.  
  1008. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE
  1009. QD3D_EXPORT TQ3Status Q3ObjectClass_Unregister(
  1010.     TQ3ObjectClass        objectClass);
  1011.  
  1012. #endif  /* QD3D_OBSOLETE  */
  1013. QD3D_EXPORT TQ3Status Q3XObjectClass_Unregister(
  1014.     TQ3XObjectClass        objectClass);
  1015.  
  1016.  
  1017. /******************************************************************************
  1018.  **                                                                             **
  1019.  **                                Object Routines                                 **
  1020.  **                                                                             **
  1021.  *****************************************************************************/
  1022.  
  1023. QD3D_EXPORT TQ3Status Q3Object_Dispose(
  1024.     TQ3Object             object);
  1025.     
  1026. QD3D_EXPORT TQ3Object Q3Object_Duplicate(
  1027.     TQ3Object            object);
  1028.     
  1029. QD3D_EXPORT TQ3Status Q3Object_Submit(
  1030.     TQ3Object            object,
  1031.     TQ3ViewObject        view);
  1032.     
  1033. QD3D_EXPORT TQ3Boolean Q3Object_IsDrawable(
  1034.     TQ3Object            object);
  1035.  
  1036. QD3D_EXPORT TQ3Boolean Q3Object_IsWritable(
  1037.     TQ3Object            object,
  1038.     TQ3FileObject        file);
  1039.  
  1040.  
  1041. /******************************************************************************
  1042.  **                                                                             **
  1043.  **                            Object Type Routines                             **
  1044.  **                                                                             **
  1045.  *****************************************************************************/
  1046.  
  1047. QD3D_EXPORT TQ3ObjectType Q3Object_GetType(
  1048.     TQ3Object            object);
  1049.  
  1050. QD3D_EXPORT TQ3ObjectType Q3Object_GetLeafType(
  1051.     TQ3Object            object);
  1052.  
  1053. QD3D_EXPORT TQ3Boolean Q3Object_IsType(
  1054.     TQ3Object            object,
  1055.     TQ3ObjectType        type);
  1056.  
  1057.  
  1058. /******************************************************************************
  1059.  **                                                                             **
  1060.  **                            Shared Object Routines                             **
  1061.  **                                                                             **
  1062.  *****************************************************************************/
  1063.  
  1064. QD3D_EXPORT TQ3ObjectType Q3Shared_GetType(
  1065.     TQ3SharedObject     sharedObject);
  1066.  
  1067. QD3D_EXPORT TQ3SharedObject Q3Shared_GetReference(
  1068.     TQ3SharedObject     sharedObject);
  1069.  
  1070. /* 
  1071.  *    Q3Shared_IsReferenced
  1072.  *        Returns kQ3True if there is more than one reference to sharedObject.
  1073.  *        Returns kQ3False if there is ONE reference to sharedObject.
  1074.  *    
  1075.  *    This call is intended to allow applications and plug-in objects to delete
  1076.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1077.  *    caching objects, etc.
  1078.  *    
  1079.  *    Although many may be tempted, DO NOT DO THIS:
  1080.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1081.  *    
  1082.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1083.  *    never fun (unless you short the stock). Thanks.
  1084.  */
  1085. QD3D_EXPORT TQ3Boolean Q3Shared_IsReferenced(
  1086.     TQ3SharedObject         sharedObject);
  1087.  
  1088. /*
  1089.  *    Q3Shared_GetEditIndex
  1090.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1091.  *        object information. Returns 0 on error.
  1092.  *        
  1093.  *        Hold onto this number to determine if an object has changed since you
  1094.  *        last built your caches... To validate, do:
  1095.  *        
  1096.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1097.  *            // Cache is valid
  1098.  *        } else {
  1099.  *            // Cache is invalid
  1100.  *            RebuildSomeSortOfCache(foo);
  1101.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1102.  *        }
  1103.  */
  1104. QD3D_EXPORT unsigned long Q3Shared_GetEditIndex(
  1105.     TQ3SharedObject         sharedObject);
  1106.  
  1107. /*
  1108.  *    Q3Shared_Edited
  1109.  *        Bumps the "serial number" of sharedObject to a different value. This
  1110.  *        call is intended to be used solely from a plug-in object which is 
  1111.  *        shared. Call this whenever your private instance data changes.
  1112.  *        
  1113.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1114.  *            QuickDraw 3D isn't initialized.
  1115.  */
  1116. QD3D_EXPORT TQ3Status Q3Shared_Edited(
  1117.     TQ3SharedObject         sharedObject);
  1118.  
  1119.  
  1120. /******************************************************************************
  1121.  **                                                                             **
  1122.  **                                Shape Routines                                 **
  1123.  **                                                                             **
  1124.  *****************************************************************************/
  1125.  
  1126. /*
  1127.  *    QuickDraw 3D 1.1 Note:
  1128.  *
  1129.  *    Shapes and Sets are now (sort of) polymorphic.
  1130.  *
  1131.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1132.  *        The following calls are identical, in implementation:
  1133.  *
  1134.  *            Q3Shape_GetElement            =    Q3Set_Get
  1135.  *            Q3Shape_AddElement            =    Q3Set_Add
  1136.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1137.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1138.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1139.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1140.  *
  1141.  *    All of these calls accept a shape or a set as their first parameter.
  1142.  *
  1143.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1144.  *    element type kQ3ElementTypeSet. See the note above about 
  1145.  *    kQ3ElementTypeSet;
  1146.  *
  1147.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1148.  *    create a set on a shape and then add the element to it. This data is
  1149.  *    attached directly to the shape. Therefore, it is possible for an element
  1150.  *    to exist on a shape without a set existing on it as well. 
  1151.  *
  1152.  *    In your application, if you attach an element to a shape like this:
  1153.  *        (this isn't checking for errors for simplicity)
  1154.  *
  1155.  *        set = Q3Set_New();
  1156.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1157.  *        Q3Shape_SetSet(shape, set);
  1158.  *
  1159.  *    You should retrieve it in the same manner:
  1160.  *
  1161.  *        Q3Shape_GetSet(shape, &set);
  1162.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1163.  *            Q3Set_Get(set, kMyElemType, &data);
  1164.  *        }
  1165.  *
  1166.  *    Similarly, if you attach data to a shape with the new calls:
  1167.  *
  1168.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1169.  *
  1170.  *    You should retrieve it in the same manner:
  1171.  *
  1172.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1173.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1174.  *        }
  1175.  *
  1176.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1177.  *    metafiles.
  1178.  *
  1179.  *    When attempting to find a particular element on a shape, you should
  1180.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1181.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1182.  *    and then Q3Shape_GetElement(set, ...).
  1183.  *
  1184.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1185.  *    used for sets of information that are shared among multiple shapes.
  1186.  *    
  1187.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1188.  *    for elements that are unique for a particular shape.
  1189.  *    
  1190.  */
  1191. QD3D_EXPORT TQ3ObjectType Q3Shape_GetType(
  1192.     TQ3ShapeObject    shape);
  1193.  
  1194. QD3D_EXPORT TQ3Status Q3Shape_GetSet(
  1195.     TQ3ShapeObject    shape,
  1196.     TQ3SetObject    *set);
  1197.  
  1198. QD3D_EXPORT TQ3Status Q3Shape_SetSet(
  1199.     TQ3ShapeObject    shape,
  1200.     TQ3SetObject     set);
  1201.  
  1202. QD3D_EXPORT TQ3Status Q3Shape_AddElement(
  1203.     TQ3ShapeObject    shape,
  1204.     TQ3ElementType    type,
  1205.     const void        *data);
  1206.  
  1207. QD3D_EXPORT TQ3Status Q3Shape_GetElement(
  1208.     TQ3ShapeObject    shape,
  1209.     TQ3ElementType    type,
  1210.     void            *data);
  1211.     
  1212. QD3D_EXPORT TQ3Boolean Q3Shape_ContainsElement(
  1213.     TQ3ShapeObject    shape,
  1214.     TQ3ElementType    type);
  1215.  
  1216. QD3D_EXPORT TQ3Status Q3Shape_GetNextElementType(
  1217.     TQ3ShapeObject    shape,
  1218.     TQ3ElementType    *type);
  1219.  
  1220. QD3D_EXPORT TQ3Status Q3Shape_EmptyElements(
  1221.     TQ3ShapeObject    shape);
  1222.  
  1223. QD3D_EXPORT TQ3Status Q3Shape_ClearElement(
  1224.     TQ3ShapeObject    shape,
  1225.     TQ3ElementType    type);
  1226.  
  1227.  
  1228. /******************************************************************************
  1229.  **                                                                             **
  1230.  **                            Color Table Routines                             **
  1231.  **                                                                             **
  1232.  *****************************************************************************/
  1233.  
  1234. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  1235.  
  1236. #if 0
  1237. /* If'ed out so linker doesn't complain */
  1238.  
  1239. QD3D_EXPORT TQ3ColorTableObject Q3ColorTable_New(
  1240.     const TQ3ColorTableData        *colorTableData);
  1241.  
  1242. QD3D_EXPORT TQ3Status Q3ColorTable_Set(
  1243.     TQ3ColorTableObject            colorTable,
  1244.     const TQ3ColorTableData        *colorTableData);
  1245.  
  1246. QD3D_EXPORT TQ3Status Q3ColorTable_Get(
  1247.     TQ3ColorTableObject            colorTable,
  1248.     const TQ3ColorTableData        *colorTableData);
  1249.  
  1250. QD3D_EXPORT TQ3Status Q3ColorTable_SetType(
  1251.     TQ3ColorTableObject            colorTable,
  1252.     TQ3ColorTableType            colorTableType);
  1253.  
  1254. QD3D_EXPORT TQ3Status Q3ColorTable_GetType(
  1255.     TQ3ColorTableObject            colorTable,
  1256.     TQ3ColorTableType            *colorTableType);
  1257.  
  1258. QD3D_EXPORT TQ3Status Q3ColorTable_SetTransparent(
  1259.     TQ3ColorTableObject            colorTable,
  1260.     TQ3Boolean                    hasTransparent);
  1261.  
  1262. QD3D_EXPORT TQ3Status Q3ColorTable_GetTransparent(
  1263.     TQ3ColorTableObject            colorTable,
  1264.     TQ3Boolean                    *hasTransparent);
  1265.  
  1266. QD3D_EXPORT TQ3Status Q3ColorTable_SetColors(
  1267.     TQ3ColorTableObject            colorTable,
  1268.     unsigned long                startIndex,
  1269.     unsigned long                count,
  1270.     const TQ3ColorRGB32            *colors);
  1271.  
  1272. QD3D_EXPORT TQ3Status Q3ColorTable_GetColors(
  1273.     TQ3ColorTableObject            colorTable,
  1274.     unsigned long                startIndex,
  1275.     unsigned long                count,
  1276.     TQ3ColorRGB32                *colors);
  1277.  
  1278. QD3D_EXPORT void Q3ColorRGB32_Set(
  1279.     TQ3ColorRGB32            *colorRGB32,
  1280.     unsigned char            r,
  1281.     unsigned char            g,
  1282.     unsigned char            b);
  1283.  
  1284. QD3D_EXPORT void Q3ColorRGB32_Get(
  1285.     TQ3ColorRGB32            colorRGB32,
  1286.     unsigned char            *r,
  1287.     unsigned char            *g,
  1288.     unsigned char            *b);
  1289. #endif  /*  0  */
  1290. #endif /* ESCHER_VER_FUTURE */
  1291.  
  1292. QD3D_EXPORT TQ3Status Q3Bitmap_Empty(
  1293.     TQ3Bitmap            *bitmap);
  1294.  
  1295. QD3D_EXPORT unsigned long Q3Bitmap_GetImageSize(
  1296.     unsigned long        width,
  1297.     unsigned long        height);
  1298.  
  1299. #ifdef __cplusplus
  1300. }
  1301. #endif  /*  __cplusplus  */
  1302.  
  1303. #if defined(__MWERKS__)
  1304.     #pragma enumsalwaysint reset
  1305. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  1306.     #pragma options enum=reset
  1307. #endif
  1308.  
  1309. #endif /*  QD3D_h  */
  1310.  
  1311.